'use strict';

const a = 1;  
console.log(a);

var [x,y,z] = ['hello world','as the moon','so beautiful']
console.log(x,y,z);

var [,,z] = ['hello world','as the moon','so beautiful']
console.log(z);


var ggboys = {
    name : 'ggboy',
    age : 18,
    address:{
        city: 'Shengzhen',
        street: 'laojie'
    }
};
var {name,age,address: {city, street}} = ggboys;

console.log(name);
console.log(age);
console.log(city);
console.log(street);

var x=1, y=2;
[x, y] = [y, x]
console.log('x='+x);
console.log('y='+y);


var zhangsan = {
    name : '张三',
    birth: 2000,
    age : function(){
        var y = new Date().getFullYear();
        return y - this.birth;
    }
}
console.log(zhangsan.age); 
console.log(zhangsan.age());